package com.sanyang.lawyer.service.hr;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sanyang.lawyer.entity.HrNation;
import com.sanyang.lawyer.entity.HrWorkhistory;
import com.sanyang.lawyer.entity.Hr_emp;
import com.sanyang.lawyer.mapper.hr.HrWorkhistoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HrWorkhistoryService {
    @Autowired
    private HrWorkhistoryMapper hrWorkhistoryMapper;

    public int save(HrWorkhistory hrWorkhistory){
        return hrWorkhistoryMapper.insert(hrWorkhistory);
    }
    public List<HrWorkhistory> getByid(int id){
        return  hrWorkhistoryMapper.getByid(id);
    }
    public HrWorkhistory workid(int id){
        return hrWorkhistoryMapper.workgetByid(id);
    }

    public int update(HrWorkhistory hrWorkhistory){
        return this.hrWorkhistoryMapper.updateById(hrWorkhistory);

    }
    public Integer delete(String empId){
        String[]arr=empId.split(",");
        int j=0;
        for (int i=0;i<arr.length;i++){
            hrWorkhistoryMapper.deleteById(Integer.parseInt(arr[i]));
            j++;
        }
        if(j>0){
            return 1;
        }else{
            return 0;
        }
    }
}
